package com.joolun.web.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.joolun.common.core.domain.AjaxResult;
import com.joolun.mall.entity.Video;
import com.joolun.mall.service.VideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 志愿api
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/weixin/api/ma/video")
@Api(value = "wish", tags = "视频")
public class VideoApi {

    @Autowired
    private VideoService videoService;

    /**
     * 分页查询视频列表
     * @param page 分页对象
     * @param entity 视频
     * @return
     */
    @ApiOperation(value = "分页查询视频列表")
    @GetMapping("/getVideoPage")
    public AjaxResult getVideoPage(Page page, Video entity) {
        return AjaxResult.success(videoService.page1(page, entity));
    }

    /**
     * 通过id查询视频信息
     * @param id
     * @return R
     */
    @ApiOperation(value = "通过id查询视频信息")
    @GetMapping("/{id}")
    public AjaxResult getById(@PathVariable("id") String id){
        Video video = videoService.getById(id);
        return AjaxResult.success(video);
    }

}